package com.gxa.controller;

import com.gxa.common.utils.R;
import com.gxa.entity.User;
import com.gxa.mapper.UserMapper1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 前后端分离 后端 返回 JSON 测试
 * @Author: zhuiyi
 * @CreatTime: 2022/10/7 15:03
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private UserMapper1 userMapper1;

    @GetMapping("/user")
    public R getUser(String userName){

        System.out.println("----------test-----------");
        User user1 = userMapper1.queryByUserName(userName);
        Map map = new HashMap();
        map.put("testUser",user1);
        return R.ok(map);
    }
}
